{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 导入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as nd\n",
    "import pandas as pd\n",
    "data = pd.read_csv('000001.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据切片"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       4.940000e+05\n",
       "1       8.400000e+04\n",
       "2       1.600000e+04\n",
       "3       3.100000e+04\n",
       "4       6.000000e+03\n",
       "            ...     \n",
       "8205    2.732820e+11\n",
       "8206    2.754430e+11\n",
       "8207    2.600950e+11\n",
       "8208    2.694770e+11\n",
       "8209    4.188720e+11\n",
       "Name: Money, Length: 8210, dtype: float64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Money']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 选取多列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Day</th>\n",
       "      <th>Close</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1990/12/19</td>\n",
       "      <td>99.9800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1990/12/20</td>\n",
       "      <td>104.3900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1990/12/21</td>\n",
       "      <td>109.1300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1990/12/24</td>\n",
       "      <td>114.5500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1990/12/25</td>\n",
       "      <td>120.2500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8205</th>\n",
       "      <td>2024/7/25</td>\n",
       "      <td>2886.7416</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8206</th>\n",
       "      <td>2024/7/26</td>\n",
       "      <td>2890.8973</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8207</th>\n",
       "      <td>2024/7/29</td>\n",
       "      <td>2891.8453</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8208</th>\n",
       "      <td>2024/7/30</td>\n",
       "      <td>2879.2996</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8209</th>\n",
       "      <td>2024/7/31</td>\n",
       "      <td>2938.7493</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8210 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             Day      Close\n",
       "0     1990/12/19    99.9800\n",
       "1     1990/12/20   104.3900\n",
       "2     1990/12/21   109.1300\n",
       "3     1990/12/24   114.5500\n",
       "4     1990/12/25   120.2500\n",
       "...          ...        ...\n",
       "8205   2024/7/25  2886.7416\n",
       "8206   2024/7/26  2890.8973\n",
       "8207   2024/7/29  2891.8453\n",
       "8208   2024/7/30  2879.2996\n",
       "8209   2024/7/31  2938.7493\n",
       "\n",
       "[8210 rows x 2 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[['Day','Close']]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 选取行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Day</th>\n",
       "      <th>Preclose</th>\n",
       "      <th>Open</th>\n",
       "      <th>Highest</th>\n",
       "      <th>Lowest</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Money</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2246</th>\n",
       "      <td>1999/12/21</td>\n",
       "      <td>1419.55</td>\n",
       "      <td>1416.5</td>\n",
       "      <td>1416.5</td>\n",
       "      <td>1388.06</td>\n",
       "      <td>1395.5</td>\n",
       "      <td>566058300</td>\n",
       "      <td>3.512110e+09</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Day Preclose    Open  Highest   Lowest   Close     Volume  \\\n",
       "2246  1999/12/21  1419.55  1416.5   1416.5  1388.06  1395.5  566058300   \n",
       "\n",
       "             Money  \n",
       "2246  3.512110e+09  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[data['Day'] =='1999/12/21']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4092    5002.84\n",
       "4093    5070.65\n",
       "4094    5144.82\n",
       "4095    5134.14\n",
       "4096    5147.71\n",
       "         ...   \n",
       "5986    5049.20\n",
       "5987    5101.44\n",
       "5988    5143.34\n",
       "5989    5174.42\n",
       "5990    5004.41\n",
       "Name: Open, Length: 97, dtype: float64"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[data['Open'] > 5000].Open"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 日期"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Day</th>\n",
       "      <th>Preclose</th>\n",
       "      <th>Open</th>\n",
       "      <th>Highest</th>\n",
       "      <th>Lowest</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Money</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1990-12-19</td>\n",
       "      <td></td>\n",
       "      <td>96.0500</td>\n",
       "      <td>99.9800</td>\n",
       "      <td>95.7900</td>\n",
       "      <td>99.9800</td>\n",
       "      <td>126000</td>\n",
       "      <td>4.940000e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1990-12-20</td>\n",
       "      <td>99.98</td>\n",
       "      <td>104.3000</td>\n",
       "      <td>104.3900</td>\n",
       "      <td>99.9800</td>\n",
       "      <td>104.3900</td>\n",
       "      <td>19700</td>\n",
       "      <td>8.400000e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1990-12-21</td>\n",
       "      <td>104.39</td>\n",
       "      <td>109.0700</td>\n",
       "      <td>109.1300</td>\n",
       "      <td>103.7300</td>\n",
       "      <td>109.1300</td>\n",
       "      <td>2800</td>\n",
       "      <td>1.600000e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1990-12-24</td>\n",
       "      <td>109.13</td>\n",
       "      <td>113.5700</td>\n",
       "      <td>114.5500</td>\n",
       "      <td>109.1300</td>\n",
       "      <td>114.5500</td>\n",
       "      <td>3200</td>\n",
       "      <td>3.100000e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1990-12-25</td>\n",
       "      <td>114.55</td>\n",
       "      <td>120.0900</td>\n",
       "      <td>120.2500</td>\n",
       "      <td>114.5500</td>\n",
       "      <td>120.2500</td>\n",
       "      <td>1500</td>\n",
       "      <td>6.000000e+03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8205</th>\n",
       "      <td>2024-07-25</td>\n",
       "      <td>2901.9518</td>\n",
       "      <td>2891.8918</td>\n",
       "      <td>2897.7674</td>\n",
       "      <td>2872.8497</td>\n",
       "      <td>2886.7416</td>\n",
       "      <td>27463950000</td>\n",
       "      <td>2.732820e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8206</th>\n",
       "      <td>2024-07-26</td>\n",
       "      <td>2886.7416</td>\n",
       "      <td>2885.9953</td>\n",
       "      <td>2899.1162</td>\n",
       "      <td>2875.3959</td>\n",
       "      <td>2890.8973</td>\n",
       "      <td>27838753600</td>\n",
       "      <td>2.754430e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8207</th>\n",
       "      <td>2024-07-29</td>\n",
       "      <td>2890.8973</td>\n",
       "      <td>2889.4726</td>\n",
       "      <td>2898.9512</td>\n",
       "      <td>2878.5825</td>\n",
       "      <td>2891.8453</td>\n",
       "      <td>25689972700</td>\n",
       "      <td>2.600950e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8208</th>\n",
       "      <td>2024-07-30</td>\n",
       "      <td>2891.8453</td>\n",
       "      <td>2885.2152</td>\n",
       "      <td>2885.2152</td>\n",
       "      <td>2865.1493</td>\n",
       "      <td>2879.2996</td>\n",
       "      <td>26247883700</td>\n",
       "      <td>2.694770e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8209</th>\n",
       "      <td>2024-07-31</td>\n",
       "      <td>2879.2996</td>\n",
       "      <td>2877.5409</td>\n",
       "      <td>2940.5927</td>\n",
       "      <td>2876.3009</td>\n",
       "      <td>2938.7493</td>\n",
       "      <td>41272341700</td>\n",
       "      <td>4.188720e+11</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8210 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Day   Preclose       Open    Highest     Lowest      Close  \\\n",
       "0    1990-12-19               96.0500    99.9800    95.7900    99.9800   \n",
       "1    1990-12-20      99.98   104.3000   104.3900    99.9800   104.3900   \n",
       "2    1990-12-21     104.39   109.0700   109.1300   103.7300   109.1300   \n",
       "3    1990-12-24     109.13   113.5700   114.5500   109.1300   114.5500   \n",
       "4    1990-12-25     114.55   120.0900   120.2500   114.5500   120.2500   \n",
       "...         ...        ...        ...        ...        ...        ...   \n",
       "8205 2024-07-25  2901.9518  2891.8918  2897.7674  2872.8497  2886.7416   \n",
       "8206 2024-07-26  2886.7416  2885.9953  2899.1162  2875.3959  2890.8973   \n",
       "8207 2024-07-29  2890.8973  2889.4726  2898.9512  2878.5825  2891.8453   \n",
       "8208 2024-07-30  2891.8453  2885.2152  2885.2152  2865.1493  2879.2996   \n",
       "8209 2024-07-31  2879.2996  2877.5409  2940.5927  2876.3009  2938.7493   \n",
       "\n",
       "           Volume         Money  \n",
       "0          126000  4.940000e+05  \n",
       "1           19700  8.400000e+04  \n",
       "2            2800  1.600000e+04  \n",
       "3            3200  3.100000e+04  \n",
       "4            1500  6.000000e+03  \n",
       "...           ...           ...  \n",
       "8205  27463950000  2.732820e+11  \n",
       "8206  27838753600  2.754430e+11  \n",
       "8207  25689972700  2.600950e+11  \n",
       "8208  26247883700  2.694770e+11  \n",
       "8209  41272341700  4.188720e+11  \n",
       "\n",
       "[8210 rows x 8 columns]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Day'] = pd.to_datetime(data['Day'], format ='%Y/%m/%d')\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据排列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Day</th>\n",
       "      <th>Preclose</th>\n",
       "      <th>Open</th>\n",
       "      <th>Highest</th>\n",
       "      <th>Lowest</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Money</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>4125</th>\n",
       "      <td>2007-10-16</td>\n",
       "      <td>6030.09</td>\n",
       "      <td>6056.95</td>\n",
       "      <td>6124.04</td>\n",
       "      <td>6040.71</td>\n",
       "      <td>6092.06</td>\n",
       "      <td>8815215900</td>\n",
       "      <td>1.640000e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4126</th>\n",
       "      <td>2007-10-17</td>\n",
       "      <td>6092.06</td>\n",
       "      <td>6057.43</td>\n",
       "      <td>6088.89</td>\n",
       "      <td>5982.20</td>\n",
       "      <td>6036.28</td>\n",
       "      <td>7131258800</td>\n",
       "      <td>1.340000e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4124</th>\n",
       "      <td>2007-10-15</td>\n",
       "      <td>5903.26</td>\n",
       "      <td>5934.77</td>\n",
       "      <td>6039.04</td>\n",
       "      <td>5866.13</td>\n",
       "      <td>6030.09</td>\n",
       "      <td>9870744200</td>\n",
       "      <td>1.930000e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4136</th>\n",
       "      <td>2007-10-31</td>\n",
       "      <td>5897.19</td>\n",
       "      <td>5984.71</td>\n",
       "      <td>6002.12</td>\n",
       "      <td>5871.48</td>\n",
       "      <td>5954.77</td>\n",
       "      <td>7102956400</td>\n",
       "      <td>1.190000e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4137</th>\n",
       "      <td>2007-11-01</td>\n",
       "      <td>5954.77</td>\n",
       "      <td>5978.94</td>\n",
       "      <td>6005.13</td>\n",
       "      <td>5912.50</td>\n",
       "      <td>5914.28</td>\n",
       "      <td>6488510300</td>\n",
       "      <td>1.110000e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>1991-05-17</td>\n",
       "      <td>105.77</td>\n",
       "      <td>105.12</td>\n",
       "      <td>106.75</td>\n",
       "      <td>104.96</td>\n",
       "      <td>106.75</td>\n",
       "      <td>2019200</td>\n",
       "      <td>7.633000e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>1991-05-15</td>\n",
       "      <td>107.19</td>\n",
       "      <td>106.56</td>\n",
       "      <td>106.60</td>\n",
       "      <td>106.42</td>\n",
       "      <td>106.57</td>\n",
       "      <td>39000</td>\n",
       "      <td>3.070000e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>102</th>\n",
       "      <td>1991-05-16</td>\n",
       "      <td>106.57</td>\n",
       "      <td>105.83</td>\n",
       "      <td>105.86</td>\n",
       "      <td>105.69</td>\n",
       "      <td>105.77</td>\n",
       "      <td>310800</td>\n",
       "      <td>1.445000e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1990-12-20</td>\n",
       "      <td>99.98</td>\n",
       "      <td>104.30</td>\n",
       "      <td>104.39</td>\n",
       "      <td>99.98</td>\n",
       "      <td>104.39</td>\n",
       "      <td>19700</td>\n",
       "      <td>8.400000e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1990-12-19</td>\n",
       "      <td></td>\n",
       "      <td>96.05</td>\n",
       "      <td>99.98</td>\n",
       "      <td>95.79</td>\n",
       "      <td>99.98</td>\n",
       "      <td>126000</td>\n",
       "      <td>4.940000e+05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8210 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Day  Preclose     Open  Highest   Lowest    Close      Volume  \\\n",
       "4125 2007-10-16   6030.09  6056.95  6124.04  6040.71  6092.06  8815215900   \n",
       "4126 2007-10-17   6092.06  6057.43  6088.89  5982.20  6036.28  7131258800   \n",
       "4124 2007-10-15   5903.26  5934.77  6039.04  5866.13  6030.09  9870744200   \n",
       "4136 2007-10-31   5897.19  5984.71  6002.12  5871.48  5954.77  7102956400   \n",
       "4137 2007-11-01   5954.77  5978.94  6005.13  5912.50  5914.28  6488510300   \n",
       "...         ...       ...      ...      ...      ...      ...         ...   \n",
       "103  1991-05-17    105.77   105.12   106.75   104.96   106.75     2019200   \n",
       "101  1991-05-15    107.19   106.56   106.60   106.42   106.57       39000   \n",
       "102  1991-05-16    106.57   105.83   105.86   105.69   105.77      310800   \n",
       "1    1990-12-20     99.98   104.30   104.39    99.98   104.39       19700   \n",
       "0    1990-12-19              96.05    99.98    95.79    99.98      126000   \n",
       "\n",
       "             Money  \n",
       "4125  1.640000e+11  \n",
       "4126  1.340000e+11  \n",
       "4124  1.930000e+11  \n",
       "4136  1.190000e+11  \n",
       "4137  1.110000e+11  \n",
       "...            ...  \n",
       "103   7.633000e+06  \n",
       "101   3.070000e+05  \n",
       "102   1.445000e+06  \n",
       "1     8.400000e+04  \n",
       "0     4.940000e+05  \n",
       "\n",
       "[8210 rows x 8 columns]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = data.sort_values(by = 'Close', ascending = False)\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 设置索引index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Preclose</th>\n",
       "      <th>Open</th>\n",
       "      <th>Highest</th>\n",
       "      <th>Lowest</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Money</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Day</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1990-12-19</th>\n",
       "      <td></td>\n",
       "      <td>96.0500</td>\n",
       "      <td>99.9800</td>\n",
       "      <td>95.7900</td>\n",
       "      <td>99.9800</td>\n",
       "      <td>126000</td>\n",
       "      <td>4.940000e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-12-20</th>\n",
       "      <td>99.98</td>\n",
       "      <td>104.3000</td>\n",
       "      <td>104.3900</td>\n",
       "      <td>99.9800</td>\n",
       "      <td>104.3900</td>\n",
       "      <td>19700</td>\n",
       "      <td>8.400000e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-12-21</th>\n",
       "      <td>104.39</td>\n",
       "      <td>109.0700</td>\n",
       "      <td>109.1300</td>\n",
       "      <td>103.7300</td>\n",
       "      <td>109.1300</td>\n",
       "      <td>2800</td>\n",
       "      <td>1.600000e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-12-24</th>\n",
       "      <td>109.13</td>\n",
       "      <td>113.5700</td>\n",
       "      <td>114.5500</td>\n",
       "      <td>109.1300</td>\n",
       "      <td>114.5500</td>\n",
       "      <td>3200</td>\n",
       "      <td>3.100000e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-12-25</th>\n",
       "      <td>114.55</td>\n",
       "      <td>120.0900</td>\n",
       "      <td>120.2500</td>\n",
       "      <td>114.5500</td>\n",
       "      <td>120.2500</td>\n",
       "      <td>1500</td>\n",
       "      <td>6.000000e+03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-25</th>\n",
       "      <td>2901.9518</td>\n",
       "      <td>2891.8918</td>\n",
       "      <td>2897.7674</td>\n",
       "      <td>2872.8497</td>\n",
       "      <td>2886.7416</td>\n",
       "      <td>27463950000</td>\n",
       "      <td>2.732820e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-26</th>\n",
       "      <td>2886.7416</td>\n",
       "      <td>2885.9953</td>\n",
       "      <td>2899.1162</td>\n",
       "      <td>2875.3959</td>\n",
       "      <td>2890.8973</td>\n",
       "      <td>27838753600</td>\n",
       "      <td>2.754430e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-29</th>\n",
       "      <td>2890.8973</td>\n",
       "      <td>2889.4726</td>\n",
       "      <td>2898.9512</td>\n",
       "      <td>2878.5825</td>\n",
       "      <td>2891.8453</td>\n",
       "      <td>25689972700</td>\n",
       "      <td>2.600950e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-30</th>\n",
       "      <td>2891.8453</td>\n",
       "      <td>2885.2152</td>\n",
       "      <td>2885.2152</td>\n",
       "      <td>2865.1493</td>\n",
       "      <td>2879.2996</td>\n",
       "      <td>26247883700</td>\n",
       "      <td>2.694770e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-31</th>\n",
       "      <td>2879.2996</td>\n",
       "      <td>2877.5409</td>\n",
       "      <td>2940.5927</td>\n",
       "      <td>2876.3009</td>\n",
       "      <td>2938.7493</td>\n",
       "      <td>41272341700</td>\n",
       "      <td>4.188720e+11</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8210 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             Preclose       Open    Highest     Lowest      Close  \\\n",
       "Day                                                                 \n",
       "1990-12-19               96.0500    99.9800    95.7900    99.9800   \n",
       "1990-12-20      99.98   104.3000   104.3900    99.9800   104.3900   \n",
       "1990-12-21     104.39   109.0700   109.1300   103.7300   109.1300   \n",
       "1990-12-24     109.13   113.5700   114.5500   109.1300   114.5500   \n",
       "1990-12-25     114.55   120.0900   120.2500   114.5500   120.2500   \n",
       "...               ...        ...        ...        ...        ...   \n",
       "2024-07-25  2901.9518  2891.8918  2897.7674  2872.8497  2886.7416   \n",
       "2024-07-26  2886.7416  2885.9953  2899.1162  2875.3959  2890.8973   \n",
       "2024-07-29  2890.8973  2889.4726  2898.9512  2878.5825  2891.8453   \n",
       "2024-07-30  2891.8453  2885.2152  2885.2152  2865.1493  2879.2996   \n",
       "2024-07-31  2879.2996  2877.5409  2940.5927  2876.3009  2938.7493   \n",
       "\n",
       "                 Volume         Money  \n",
       "Day                                    \n",
       "1990-12-19       126000  4.940000e+05  \n",
       "1990-12-20        19700  8.400000e+04  \n",
       "1990-12-21         2800  1.600000e+04  \n",
       "1990-12-24         3200  3.100000e+04  \n",
       "1990-12-25         1500  6.000000e+03  \n",
       "...                 ...           ...  \n",
       "2024-07-25  27463950000  2.732820e+11  \n",
       "2024-07-26  27838753600  2.754430e+11  \n",
       "2024-07-29  25689972700  2.600950e+11  \n",
       "2024-07-30  26247883700  2.694770e+11  \n",
       "2024-07-31  41272341700  4.188720e+11  \n",
       "\n",
       "[8210 rows x 7 columns]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = data.set_index(\"Day\")\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Preclose</th>\n",
       "      <th>Open</th>\n",
       "      <th>Highest</th>\n",
       "      <th>Lowest</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Money</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Day</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2024-01-02</th>\n",
       "      <td>2974.9348</td>\n",
       "      <td>2972.7750</td>\n",
       "      <td>2976.2682</td>\n",
       "      <td>2962.2762</td>\n",
       "      <td>2962.2762</td>\n",
       "      <td>30414179300</td>\n",
       "      <td>3.459510e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-01-03</th>\n",
       "      <td>2962.2762</td>\n",
       "      <td>2957.1117</td>\n",
       "      <td>2971.2834</td>\n",
       "      <td>2953.2901</td>\n",
       "      <td>2967.2472</td>\n",
       "      <td>28545594500</td>\n",
       "      <td>3.210180e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-01-04</th>\n",
       "      <td>2967.2472</td>\n",
       "      <td>2965.5087</td>\n",
       "      <td>2966.6828</td>\n",
       "      <td>2936.6347</td>\n",
       "      <td>2954.3486</td>\n",
       "      <td>26498092400</td>\n",
       "      <td>2.962910e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-01-05</th>\n",
       "      <td>2954.3486</td>\n",
       "      <td>2949.8221</td>\n",
       "      <td>2967.9677</td>\n",
       "      <td>2916.7206</td>\n",
       "      <td>2929.1833</td>\n",
       "      <td>30104023900</td>\n",
       "      <td>3.259170e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-01-08</th>\n",
       "      <td>2929.1833</td>\n",
       "      <td>2923.4570</td>\n",
       "      <td>2924.4559</td>\n",
       "      <td>2887.5379</td>\n",
       "      <td>2887.5379</td>\n",
       "      <td>27027505500</td>\n",
       "      <td>2.907310e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-25</th>\n",
       "      <td>2901.9518</td>\n",
       "      <td>2891.8918</td>\n",
       "      <td>2897.7674</td>\n",
       "      <td>2872.8497</td>\n",
       "      <td>2886.7416</td>\n",
       "      <td>27463950000</td>\n",
       "      <td>2.732820e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-26</th>\n",
       "      <td>2886.7416</td>\n",
       "      <td>2885.9953</td>\n",
       "      <td>2899.1162</td>\n",
       "      <td>2875.3959</td>\n",
       "      <td>2890.8973</td>\n",
       "      <td>27838753600</td>\n",
       "      <td>2.754430e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-29</th>\n",
       "      <td>2890.8973</td>\n",
       "      <td>2889.4726</td>\n",
       "      <td>2898.9512</td>\n",
       "      <td>2878.5825</td>\n",
       "      <td>2891.8453</td>\n",
       "      <td>25689972700</td>\n",
       "      <td>2.600950e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-30</th>\n",
       "      <td>2891.8453</td>\n",
       "      <td>2885.2152</td>\n",
       "      <td>2885.2152</td>\n",
       "      <td>2865.1493</td>\n",
       "      <td>2879.2996</td>\n",
       "      <td>26247883700</td>\n",
       "      <td>2.694770e+11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-07-31</th>\n",
       "      <td>2879.2996</td>\n",
       "      <td>2877.5409</td>\n",
       "      <td>2940.5927</td>\n",
       "      <td>2876.3009</td>\n",
       "      <td>2938.7493</td>\n",
       "      <td>41272341700</td>\n",
       "      <td>4.188720e+11</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>140 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             Preclose       Open    Highest     Lowest      Close  \\\n",
       "Day                                                                 \n",
       "2024-01-02  2974.9348  2972.7750  2976.2682  2962.2762  2962.2762   \n",
       "2024-01-03  2962.2762  2957.1117  2971.2834  2953.2901  2967.2472   \n",
       "2024-01-04  2967.2472  2965.5087  2966.6828  2936.6347  2954.3486   \n",
       "2024-01-05  2954.3486  2949.8221  2967.9677  2916.7206  2929.1833   \n",
       "2024-01-08  2929.1833  2923.4570  2924.4559  2887.5379  2887.5379   \n",
       "...               ...        ...        ...        ...        ...   \n",
       "2024-07-25  2901.9518  2891.8918  2897.7674  2872.8497  2886.7416   \n",
       "2024-07-26  2886.7416  2885.9953  2899.1162  2875.3959  2890.8973   \n",
       "2024-07-29  2890.8973  2889.4726  2898.9512  2878.5825  2891.8453   \n",
       "2024-07-30  2891.8453  2885.2152  2885.2152  2865.1493  2879.2996   \n",
       "2024-07-31  2879.2996  2877.5409  2940.5927  2876.3009  2938.7493   \n",
       "\n",
       "                 Volume         Money  \n",
       "Day                                    \n",
       "2024-01-02  30414179300  3.459510e+11  \n",
       "2024-01-03  28545594500  3.210180e+11  \n",
       "2024-01-04  26498092400  2.962910e+11  \n",
       "2024-01-05  30104023900  3.259170e+11  \n",
       "2024-01-08  27027505500  2.907310e+11  \n",
       "...                 ...           ...  \n",
       "2024-07-25  27463950000  2.732820e+11  \n",
       "2024-07-26  27838753600  2.754430e+11  \n",
       "2024-07-29  25689972700  2.600950e+11  \n",
       "2024-07-30  26247883700  2.694770e+11  \n",
       "2024-07-31  41272341700  4.188720e+11  \n",
       "\n",
       "[140 rows x 7 columns]"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['2024-01':'2024-07']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1231321"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
